package com.gloaba.common.mongo.service;

import org.bson.Document;
import org.springframework.data.domain.Page;

import java.util.List;
import java.util.Map;

public interface IBaseMongoDocumentService {
    void save(String tableName, String json);
    List<Document> findByCriteria(String tableName, Map<String, Object> criteria);
    long saveBatch(String tableName, String bsonArrayString);
    void dropCollection(String tableName);
    long countByConditions(String tableName, Map<String, Object> conditions);
    long countDocuments(String tableName);
    long countDocumentsByCondition(String tableName, String key, String value);
    long countDocumentsByConditions(List<Map<String, String>> conditionLists,String tableName);
    long countDocumentsByConditions(String tableName, Map<String, Object> conditions);
    boolean collectionExists(String tableName);
    List<Document> findByPage(String tableName, int page, int size, String sortBy, boolean isAsc);
    Page<Document> findByPage(String tableName, int page, int size, String sortBy, boolean isAsc, Map<String, Object> conditions);
    Object findFirstByConditions(String tableName, String field, Map<String, Object> conditions, String sortBy, boolean isAsc);
}
